package com.xiaoshuidi.cloud.module.rooms.repository;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoshuidi.cloud.module.rooms.mapper.RoomDeviceStairPriceMapper;
import com.xiaoshuidi.cloud.module.rooms.pojo.RoomDeviceStairPrice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @BelongsProject: lease-module-rooms
 * @BelongsPackage: com.xiaoshuidi.cloud.module.rooms.repository
 * @Author: James
 * @CreateTime: 2023-06-07  14:53
 * @Description: TODO
 * @Version: 1.0
 */
@Component
public class IotRoomDeviceStairPriceRepository extends ServiceImpl<RoomDeviceStairPriceMapper, RoomDeviceStairPrice> {
    @Autowired
    RoomDeviceStairPriceMapper roomDeviceStairPriceMapper;
    public int deleteStrirByPriceId (Long priceId){
        QueryWrapper<RoomDeviceStairPrice> wrapper = new QueryWrapper();
        wrapper.eq("room_device_id",priceId);
        return roomDeviceStairPriceMapper.delete(wrapper);
    }

    public RoomDeviceStairPrice getDeviceListByRoomId (Long roomDeviceId){
        QueryWrapper<RoomDeviceStairPrice> wrapper = new QueryWrapper();
        wrapper.eq("room_device_id",roomDeviceId);
        return roomDeviceStairPriceMapper.selectOne(wrapper);
    }



}
